<?php
session_start();
if(!session_is_registered(myusername)){
//header("location:index.html");
$name = $_SESSION['name'];
$username = $_SESSION['username'];

}
?>			<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
			<html>
			<head>
			</head>
			<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
			<title>Images already diagnosed</title>
			
			<!--creates cookie called 'imagePath' to store location of image. expires at end of session-->
			<script>
			function setCookie(urlParam){
			var url= urlParam.toString();
			var query_string = url.split("?");
			var param_item = query_string[1].split("=");
			
			
			document.cookie = 'imagePath='+param_item[1]+';'
			}
			
			</script>
			
			<body>	
			<?php
				include "config.php";
				
				
				$result = mysql_query("SELECT * FROM images WHERE counter != 0");
				
				echo "<h3>There are ". mysql_num_rows($result) ." diagnoses waiting to be rated:</h3>";
				$index=0;
				while($row = mysql_fetch_array($result))
					{		$index++;
							if ($index%2==1){
							echo "<br/>";
							}
							echo 	"<a href='rate_image.php?bkgd_url=". $row[file_path] .
									"'  onclick=\"setCookie(this)\"><img src=".$row[file_path].
									" width=200 height=230></a>   // LINK IS WRONG";
					}
				if (mysql_num_rows($result) == 0) {
					echo "<h3>No images left to be diagnosed. Click <a href='welcome.php'>here</a> to go back</h3>";
				}
				mysql_close($con);
				?>
			</body>
			</html>
